const express = require('express');
const router = express.Router();
const data = [];

for(let i = 1; i < 51; i++)
    data.push({
        id: `${i}`,
        code: `XS2019082700-${i}`,
        dealerCode: '10145',
        dealerName: '测试经销商',
        orderTypeHis: 1,
        priceTerms: 1,
        paymentHisType: 1,
        shipmentType: 1,
        totalAmount: 1,
        spFreight: 1,
        spInsurance: 50,
        piCreateDate: '2019-08-04T02:37:44.918Z',
        piConfirmDate: '2019-08-04T02:37:44.918Z',
        submitDate: '2019-08-04T02:37:44.918Z',
        stockCreatDate: '2019-08-04T02:37:44.918Z',
    });
router.get('/forCurrentUser', (req, res) => {
    const {pageIndex, pageSize} = req.query;
    res.json({
        message: 'ok',
        payload: {
            content: data,
            pageIndex: parseInt(pageIndex, 10),
            pageSize: parseInt(pageSize, 10),
            totalElements: 50
        }
    });
});

router.get('/:id', (req, res) => {
    res.json({
        message: 'ok',
        payload: {
            id: '1',
            code: 'XS2019082700-1',
            dealerCode: '10145',
            dealerName: '测试经销商',
            orderTypeHis: 1,
            priceTerms: 1,
            paymentHisType: 1,
            shipmentType: 1,
            totalAmount: 1,
            currency: 1,
            piCreateDate: '2019-08-04T02:37:44.918Z',
            piConfirmDate: '2019-08-04T02:37:44.918Z',
            submitDate: '2019-08-04T02:37:44.918Z',
            stockCreatDate: '2019-08-04T02:37:44.918Z',
            remark: 'string',
            country: '中国',
            contactPerson: 'contactPerson',
            contactPhone: 'contactPhone',
            consigneeAddress: 'consigneeAddress',
            account: 'account',
            designatedForwarder: 'designatedForwarder',
            destinationPort: 'destinationPort',
            deliveryPort: 'deliveryPort',
            details: [
                {
                    id: '1',
                    partId: '1',
                    partCode: 'partCode1',
                    partName: 'partName1',
                    partEngName: 'partEngName',
                    productCategoryCode: 'productCategoryCode',
                    planQuantity: 2,
                    minPackSize: 1
                }
            ],
            processDetails: [
                {
                    id: '1',
                    processer: 'processer',
                    processStatus: 2,
                    processComment: 'processComment',
                    processDate: '2019-08-04T02:37:44.918Z',
                }
            ]
        }
    });
});


module.exports = router;
